﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BUS.DAL
{
    class AdminDAL
    {
        internal static AdminBUS DangNhap(AdminBUS adminBUS)
        {
            ShopDataContext db = new ShopDataContext();
            var admins = from a in db.Admins
                         where a.UserName == adminBUS.UserName && a.PassWord == adminBUS.Pass
                         select new AdminBUS()
                         {
                             UserName = a.UserName,
                             Pass = a.PassWord,
                             Role = a.Role == null ? 0 : (int)a.Role,
                         };
            return admins.FirstOrDefault<AdminBUS>();
        }
    }
}
